const Admin = require("./models/AdminModel");

// 登录确定
exports.loginDao = async function (info) {
    const loginId = info.loginId ? info.loginId : "";
    const loginPwd = info.loginPwd ? info.loginPwd : "";
    const result = await Admin.findOne({
        where: {
            loginId,
            loginPwd,
        }
    })
    return result ? result.toJSON() : result;
}

// 更新管理员
exports.updateAdmin = async function (infos) {
    const result = await Admin.update(infos, {
        where: {
            loginId: infos.loginId,
            loginPwd: infos.oldLoginPwd,
        }
    })
    return result;
}